package com.fowo.api.controller.amazon;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.fowo.api.common.model.IdListPo;
import com.fowo.api.common.model.R;
import com.fowo.api.common.util.ResponseUtils;
import com.fowo.api.entity.AmazonSettlementReportTransManage;
import com.fowo.api.service.impl.AmazonSettlementReportSummaryServiceImpl;
import com.fowo.api.service.impl.AmazonSettlementReportTransManageServiceImpl;
import com.fowo.api.sys.entity.SysFile;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.core.io.ClassPathResource;
import org.springframework.util.StreamUtils;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;

@Tag(name = "亚马逊结算中心")
@RequestMapping("/api/amazonSummaryReport")
@RestController
public class AmazonSettlementSummaryReportController {


    @Resource
    private AmazonSettlementReportSummaryServiceImpl amazonSettlementReportSummaryService;

    @Operation(summary = "pdf解析")
    @PostMapping("/analysisPdf")
    public R analysisPdf(@RequestBody SysFile sysFile,String data) throws Exception {
        amazonSettlementReportSummaryService.analysisPdf(sysFile,data);
        return R.data("ok");
    }
    @Operation(summary = "pdf下载")
    @PostMapping("/download")
    public void analysisPdf2(@RequestBody IdListPo po,HttpServletResponse response) throws IOException {
        amazonSettlementReportSummaryService.download(po,response);
    }
    @Operation(summary = "批量删除summary报表")
    @PostMapping("/batchDelete")
    public void deletePdf2(@RequestBody IdListPo po,HttpServletResponse response) throws IOException {
        amazonSettlementReportSummaryService.batchDelete(po,response);
    }

}
